const express = require('express')
const cors = require('cors')
const app = express()

app.use(cors({
  origin: 'http://localhost:8080' // 你的Taro开发服务器地址
}))

app.use(express.json())

app.get('/test', (req, res) => {
  res.json({ message: 'GET请求成功' })
})

app.post('/test', (req, res) => {
  console.log('收到数据:', req.body)
  res.json({ message: 'POST请求成功', receivedData: req.body })
})

app.listen(3000, () => {
  console.log('服务器运行在 http://localhost:3000')
})
